package com.wicket.okrobff.biz.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.wicket.okrobff.biz.service.SecurityService;
import com.wicket.okrobff.biz.service.dto.req.*;
import com.wicket.okrobff.biz.service.dto.res.*;
import com.wicket.okrobff.common.ro.OkrResult;
import com.wicket.okrobff.common.ro.OkrResult;
import com.wicket.okrobff.common.util.CommonFunctionHelper;
import com.wicket.okrobff.common.util.RedisUtil;
import javax.annotation.Resource;

import com.wicket.okroperation.integration.dto.*;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import com.wicket.okroperation.integration.FwOperationSecurityClient;
import com.wicket.okrobff.common.exception.Assert;
import com.wicket.okrframework.integration.FwBaseInductionRecordClient;
import com.wicket.okrframework.integration.dto.QueryInductionRecordInfoDetailComRespDto;
import com.wicket.okrframework.integration.dto.QueryInductionRecordInfoDetailComReqDto;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@Service
public class SecurityServiceImpl implements SecurityService {

  @Resource
  private RedisUtil redisUtil;
@Resource
  FwOperationSecurityClient fwOperationSecurityClient;
@Resource
  FwBaseInductionRecordClient fwBaseInductionRecordClient;
/**
   * B6存档软件授权证书(管理)[6619]
   * gen by moon at 5/29/2023, 4:41:35 AM
   */
    @Trace(operationName = "B6存档软件授权证书(管理)")
    @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Override
  public BffArchiveSoftwareAuthorizationRespDto archiveSoftwareAuthorization(BffArchiveSoftwareAuthorizationReqDto reqDto){
      
       
       //步骤0: D6存档软件授权证书 - archiveSoftwareAuthorization
        ArchiveSoftwareAuthorizationRespDto archiveSoftwareAuthorizationRespDto = null;
    com.wicket.okroperation.integration.dto.ArchiveSoftwareAuthorizationReqDto archiveSoftwareAuthorizationReqDto=new ArchiveSoftwareAuthorizationReqDto();
  if(reqDto!=null){
      archiveSoftwareAuthorizationReqDto.setAuthorizationId(reqDto.getAuthorizationId());//SimpleFieldAssign//sourceId:929053_1
    }
  
    /*D6存档软件授权证书[6618]   */
    Assert.isNull(archiveSoftwareAuthorizationReqDto.getAuthorizationId(),"B6存档软件授权证书(管理)-D6存档软件授权证书-授权证书ID不能为空",false);
      archiveSoftwareAuthorizationRespDto = fwOperationSecurityClient.archiveSoftwareAuthorization(archiveSoftwareAuthorizationReqDto).getData()/*vcase invoke 跨dubbo调用;*/;
      
      
      
    
BffArchiveSoftwareAuthorizationRespDto retData = new BffArchiveSoftwareAuthorizationRespDto();
  
  

  
  
return retData;
  }
/**
   * B6查询软件授权证书详情(管理)[6611]
   * gen by moon at 5/18/2023, 4:45:19 PM
   */
    @Trace(operationName = "B6查询软件授权证书详情(管理)")
    @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Override
  public BffQuerySoftwareAuthorizationDetailRespDto querySoftwareAuthorizationDetail(BffQuerySoftwareAuthorizationDetailReqDto reqDto){


        QuerySoftwareAuthorizationDetailRespDto querySoftwareAuthorizationDetailRespDto_1 =null;
QueryInductionRecordInfoDetailComRespDto queryInductionRecordInfoDetailComRespDto_1 =null;
//步骤0: D6查询软件授权证书详情 - querySoftwareAuthorizationDetail
     com.wicket.okroperation.integration.dto.QuerySoftwareAuthorizationDetailRespDto querySoftwareAuthorizationDetailRespDto = null;
        // TODO: 2023/5/19 手写代码
    com.wicket.okroperation.integration.dto.QuerySoftwareAuthorizationDetailReqDto querySoftwareAuthorizationDetailReqDto=new QuerySoftwareAuthorizationDetailReqDto();
  if(reqDto!=null){
      querySoftwareAuthorizationDetailReqDto.setAuthorizationId(reqDto.getAuthorizationId());//SimpleFieldAssign//sourceId:928589_1
    }
  
    /*D6查询软件授权证书详情[6610]   */
    
      querySoftwareAuthorizationDetailRespDto = fwOperationSecurityClient.querySoftwareAuthorizationDetail(querySoftwareAuthorizationDetailReqDto).getData()/*vcase invoke 跨dubbo调用;*/;
      
      
      querySoftwareAuthorizationDetailRespDto_1 = querySoftwareAuthorizationDetailRespDto;
    
//步骤1: D1-3查询个人就职记录信息详情（公共） - queryInductionRecordInfoDetailCom
     QueryInductionRecordInfoDetailComRespDto queryInductionRecordInfoDetailComRespDto = null;
    if(querySoftwareAuthorizationDetailRespDto !=null){
          QueryInductionRecordInfoDetailComReqDto queryInductionRecordInfoDetailComReqDto=new QueryInductionRecordInfoDetailComReqDto();
  if(querySoftwareAuthorizationDetailRespDto!=null){
      queryInductionRecordInfoDetailComReqDto.setInductionRecordId(querySoftwareAuthorizationDetailRespDto.getOperationInductionId());//SimpleFieldAssign//sourceId:928654_1
    }
  
    /*D1-3查询个人就职记录信息详情（公共）[715]   */
    Assert.isNull(queryInductionRecordInfoDetailComReqDto.getInductionRecordId(),"B6查询软件授权证书详情(管理)-D1-3查询个人就职记录信息详情（公共）-就职记录ID不能为空",false);
      queryInductionRecordInfoDetailComRespDto = fwBaseInductionRecordClient.queryInductionRecordInfoDetailCom(queryInductionRecordInfoDetailComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;
      
      
      queryInductionRecordInfoDetailComRespDto_1 = queryInductionRecordInfoDetailComRespDto;
           }
    
BffQuerySoftwareAuthorizationDetailRespDto retData = new BffQuerySoftwareAuthorizationDetailRespDto();
  if(querySoftwareAuthorizationDetailRespDto_1!=null){
      retData.setAuthorizationId(querySoftwareAuthorizationDetailRespDto_1.getAuthorizationId());//SimpleFieldAssign//sourceId:928624_1
retData.setAuthorizationName(querySoftwareAuthorizationDetailRespDto_1.getAuthorizationName());//SimpleFieldAssign//sourceId:928625_1
retData.setSchOpenRecordId(querySoftwareAuthorizationDetailRespDto_1.getSchOpenRecordId());//SimpleFieldAssign//sourceId:928626_1
retData.setSchOpenRecordCode(querySoftwareAuthorizationDetailRespDto_1.getSchOpenRecordCode());//SimpleFieldAssign//sourceId:928627_1
retData.setApplObjType(querySoftwareAuthorizationDetailRespDto_1.getApplObjType());//SimpleFieldAssign//sourceId:931062_1
retData.setAuthorizationKeyTypeCode(querySoftwareAuthorizationDetailRespDto_1.getAuthorizationKeyTypeCode());//SimpleFieldAssign//sourceId:932207_1
retData.setAuthorizationObjectId(querySoftwareAuthorizationDetailRespDto_1.getAuthorizationObjectId());//SimpleFieldAssign//sourceId:928629_1
retData.setApplexName(querySoftwareAuthorizationDetailRespDto_1.getApplexName());//SimpleFieldAssign//sourceId:928630_1
retData.setAuthorizationSpaceId(querySoftwareAuthorizationDetailRespDto_1.getAuthorizationSpaceId());//SimpleFieldAssign//sourceId:928631_1
retData.setSpaceShortName(querySoftwareAuthorizationDetailRespDto_1.getSpaceShortName());//SimpleFieldAssign//sourceId:928632_1
retData.setDnsAddresses(querySoftwareAuthorizationDetailRespDto_1.getDnsAddresses());//SimpleFieldAssign//sourceId:928633_1
retData.setIpAddresses(querySoftwareAuthorizationDetailRespDto_1.getIpAddresses());//SimpleFieldAssign//sourceId:928634_1
retData.setServerMacCode(querySoftwareAuthorizationDetailRespDto_1.getServerMacCode());//SimpleFieldAssign//sourceId:928635_1
retData.setIsMainAuthorization(querySoftwareAuthorizationDetailRespDto_1.getIsMainAuthorization());//SimpleFieldAssign//sourceId:928636_1
retData.setIsDeploymentEnabled(querySoftwareAuthorizationDetailRespDto_1.getIsDeploymentEnabled());//SimpleFieldAssign//sourceId:928637_1
retData.setAuthorizationSchemeId(querySoftwareAuthorizationDetailRespDto_1.getAuthorizationSchemeId());//SimpleFieldAssign//sourceId:928638_1
retData.setSchemeAuthorizationType(querySoftwareAuthorizationDetailRespDto_1.getSchemeAuthorizationType());//SimpleFieldAssign//sourceId:928639_1
retData.setAuthorizationNum(querySoftwareAuthorizationDetailRespDto_1.getAuthorizationNum());//SimpleFieldAssign//sourceId:928640_1
retData.setAuthorizationStartTime(querySoftwareAuthorizationDetailRespDto_1.getAuthorizationStartTime());//SimpleFieldAssign//sourceId:928641_1
retData.setAuthorizationEndTime(querySoftwareAuthorizationDetailRespDto_1.getAuthorizationEndTime());//SimpleFieldAssign//sourceId:928642_1
retData.setAuthorizationUnit(querySoftwareAuthorizationDetailRespDto_1.getAuthorizationUnit());//SimpleFieldAssign//sourceId:928643_1
retData.setDeployTypeCode(querySoftwareAuthorizationDetailRespDto_1.getDeployTypeCode());//SimpleFieldAssign//sourceId:928644_1
retData.setSubjectLifeCycle(querySoftwareAuthorizationDetailRespDto_1.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:928645_1
retData.setOperationInductionId(querySoftwareAuthorizationDetailRespDto_1.getOperationInductionId());//SimpleFieldAssign//sourceId:928646_1
retData.setOperateTime(querySoftwareAuthorizationDetailRespDto_1.getOperateTime());//SimpleFieldAssign//sourceId:928647_1
    }
if(queryInductionRecordInfoDetailComRespDto_1!=null){
      retData.setUserId(queryInductionRecordInfoDetailComRespDto_1.getUserId());//SimpleFieldAssign//sourceId:928666_1
retData.setIdCardName(queryInductionRecordInfoDetailComRespDto_1.getIdCardName());//SimpleFieldAssign//sourceId:928667_1
retData.setNickName(queryInductionRecordInfoDetailComRespDto_1.getNickName());//SimpleFieldAssign//sourceId:928668_1
retData.setUserFace(queryInductionRecordInfoDetailComRespDto_1.getUserFace());//SimpleFieldAssign//sourceId:947460_1
    }
  

  
  
return retData;
  }
/**
   * B6修改软件授权证书(管理)[6614]
   * gen by moon at 5/25/2023, 11:23:06 PM
   */
    @Trace(operationName = "B6修改软件授权证书(管理)")
    @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Override
  public BffUpdateSoftwareAuthorizationRespDto updateSoftwareAuthorization(BffUpdateSoftwareAuthorizationReqDto reqDto){
      
       
       //步骤0: D6修改软件授权证书 - updateSoftwareAuthorization
        UpdateSoftwareAuthorizationRespDto updateSoftwareAuthorizationRespDto = null;
        // TODO: 2023/5/19 手写代码
    com.wicket.okroperation.integration.dto.UpdateSoftwareAuthorizationReqDto updateSoftwareAuthorizationReqDto=new UpdateSoftwareAuthorizationReqDto();
  if(reqDto!=null){
      updateSoftwareAuthorizationReqDto.setAuthorizationId(reqDto.getAuthorizationId());//SimpleFieldAssign//sourceId:928822_1
updateSoftwareAuthorizationReqDto.setAuthorizationName(reqDto.getAuthorizationName());//SimpleFieldAssign//sourceId:928823_1
updateSoftwareAuthorizationReqDto.setDnsAddresses(reqDto.getDnsAddresses());//SimpleFieldAssign//sourceId:931075_1
updateSoftwareAuthorizationReqDto.setIpAddresses(reqDto.getIpAddresses());//SimpleFieldAssign//sourceId:931076_1
updateSoftwareAuthorizationReqDto.setServerMacCode(reqDto.getServerMacCode());//SimpleFieldAssign//sourceId:931077_1
updateSoftwareAuthorizationReqDto.setDeployTypeCode(reqDto.getDeployTypeCode());//SimpleFieldAssign//sourceId:928825_1
    }
  
    /*D6修改软件授权证书[6613]   */
    Assert.isNull(updateSoftwareAuthorizationReqDto.getAuthorizationId(),"B6修改软件授权证书(管理)-D6修改软件授权证书-授权证书ID不能为空",false);
      updateSoftwareAuthorizationRespDto = fwOperationSecurityClient.updateSoftwareAuthorization(updateSoftwareAuthorizationReqDto).getData()/*vcase invoke 跨dubbo调用;*/;
      
      
      
    
BffUpdateSoftwareAuthorizationRespDto retData = new BffUpdateSoftwareAuthorizationRespDto();
  
  

  
  
return retData;
  }
/**
   * B6删除软件授权证书(管理)[6617]
   * gen by moon at 5/18/2023, 4:45:23 PM
   */
    @Trace(operationName = "B6删除软件授权证书(管理)")
    @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Override
  public BffDeleteSoftwareAuthorizationRespDto deleteSoftwareAuthorization(BffDeleteSoftwareAuthorizationReqDto reqDto){
      
       
       //步骤0: D6删除软件授权证书 - deleteSoftwareAuthorization
        DeleteSoftwareAuthorizationRespDto deleteSoftwareAuthorizationRespDto = null;
        // TODO: 2023/5/19 手写代码
    com.wicket.okroperation.integration.dto.DeleteSoftwareAuthorizationReqDto deleteSoftwareAuthorizationReqDto=new DeleteSoftwareAuthorizationReqDto();
  if(reqDto!=null){
      deleteSoftwareAuthorizationReqDto.setAuthorizationId(reqDto.getAuthorizationId());//SimpleFieldAssign//sourceId:928920_1
    }
  
    /*D6删除软件授权证书[6616]   */
    Assert.isNull(deleteSoftwareAuthorizationReqDto.getAuthorizationId(),"B6删除软件授权证书(管理)-D6删除软件授权证书-授权证书ID不能为空",false);
      deleteSoftwareAuthorizationRespDto = fwOperationSecurityClient.deleteSoftwareAuthorization(deleteSoftwareAuthorizationReqDto).getData()/*vcase invoke 跨dubbo调用;*/;
      
      
      
    
BffDeleteSoftwareAuthorizationRespDto retData = new BffDeleteSoftwareAuthorizationRespDto();
  
  

  
  
return retData;
  }
/**
   * B6执行刷软件授权证书(管理)[6714]
   * gen by moon at 5/21/2023, 7:13:53 AM
   */
    @Trace(operationName = "B6执行刷软件授权证书(管理)")
    @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Override
  public BffImplementBrushSoftwareAuthorizationRespDto implementBrushSoftwareAuthorization(BffImplementBrushSoftwareAuthorizationReqDto reqDto){


       //步骤0: D6执行刷软件授权证书 - implementBrushSoftwareAuthorization
     ImplementBrushSoftwareAuthorizationRespDto implementBrushSoftwareAuthorizationRespDto = null;
    ImplementBrushSoftwareAuthorizationReqDto implementBrushSoftwareAuthorizationReqDto=new ImplementBrushSoftwareAuthorizationReqDto();
  if(reqDto!=null){
      implementBrushSoftwareAuthorizationReqDto.setTenantSpaceId(reqDto.getTenantSpaceId());//SimpleFieldAssign//sourceId:945593_1
    }

    /*D6执行刷软件授权证书[6705]   */
    Assert.isNull(implementBrushSoftwareAuthorizationReqDto.getTenantSpaceId(),"B6执行刷软件授权证书(管理)-D6执行刷软件授权证书-租户空间ID不能为空",false);
      implementBrushSoftwareAuthorizationRespDto = fwOperationSecurityClient.implementBrushSoftwareAuthorization(implementBrushSoftwareAuthorizationReqDto).getData()/*vcase invoke 跨dubbo调用;*/;




BffImplementBrushSoftwareAuthorizationRespDto retData = new BffImplementBrushSoftwareAuthorizationRespDto();





return retData;
  }
/**
   * B6生成License(管理)[6955]
   * gen by moon at 5/25/2023, 11:23:13 PM
   */
    @Trace(operationName = "B6生成License(管理)")
    @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Override
  public BffGenerateGenerateLicenseRespDto generateGenerateLicense(BffGenerateGenerateLicenseReqDto reqDto){


        AddGenerateLicenseComRespDto addGenerateLicenseComRespDto_1 =null;
//步骤0: D6生成License(公共) - addGenerateLicenseCom
        // TODO: 2023/5/26 手写代码 
     com.wicket.okroperation.integration.dto.AddGenerateLicenseComRespDto addGenerateLicenseComRespDto = null;
    com.wicket.okroperation.integration.dto.AddGenerateLicenseComReqDto addGenerateLicenseComReqDto=new AddGenerateLicenseComReqDto();
  if(reqDto!=null){
      addGenerateLicenseComReqDto.setAuthorizationSpaceId(reqDto.getAuthorizationSpaceId());//SimpleFieldAssign//sourceId:984673_1
    }

    /*D6生成License(公共)[6643]   */
    Assert.isNull(addGenerateLicenseComReqDto.getAuthorizationSpaceId(),"B6生成License(管理)-D6生成License(公共)-租户空间ID不能为空",false);
      addGenerateLicenseComRespDto = fwOperationSecurityClient.addGenerateLicenseCom(addGenerateLicenseComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


      addGenerateLicenseComRespDto_1 = addGenerateLicenseComRespDto;

BffGenerateGenerateLicenseRespDto retData = new BffGenerateGenerateLicenseRespDto();
  if(addGenerateLicenseComRespDto_1!=null){
      retData.setCodeHeaderText(addGenerateLicenseComRespDto_1.getCodeHeaderText());//SimpleFieldAssign//sourceId:984675_1
retData.setCodeImplementText(addGenerateLicenseComRespDto_1.getCodeImplementText());//SimpleFieldAssign//sourceId:984676_1
    }




return retData;
  }
  //
}
